package com.ruoyi.web.controller.situation;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.situation.domain.DySgReal;
import com.ruoyi.situation.service.IDySgRealService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 大营束管实时Controller
 * 
 * @author lth
 * @date 2024-12-06
 */
@RestController
@RequestMapping("/situation/real")
public class DySgRealController extends BaseController
{
    @Autowired
    private IDySgRealService dySgRealService;

    /**
     * 查询大营束管实时列表
     */
    @PreAuthorize("@ss.hasPermi('situation:real:list')")
    @GetMapping("/list")
    public TableDataInfo list(DySgReal dySgReal)
    {
        startPage();
        List<DySgReal> list = dySgRealService.selectDySgRealList(dySgReal);
        return getDataTable(list);
    }

    /**
     * 导出大营束管实时列表
     */
    @PreAuthorize("@ss.hasPermi('situation:real:export')")
    @Log(title = "大营束管实时", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DySgReal dySgReal)
    {
        List<DySgReal> list = dySgRealService.selectDySgRealList(dySgReal);
        ExcelUtil<DySgReal> util = new ExcelUtil<DySgReal>(DySgReal.class);
        util.exportExcel(response, list, "大营束管实时数据");
    }

    /**
     * 获取大营束管实时详细信息
     */
    @PreAuthorize("@ss.hasPermi('situation:real:query')")
    @GetMapping(value = "/{sgcdssId}")
    public AjaxResult getInfo(@PathVariable("sgcdssId") Long sgcdssId)
    {
        return success(dySgRealService.selectDySgRealBySgcdssId(sgcdssId));
    }

    /**
     * 新增大营束管实时
     */
    @PreAuthorize("@ss.hasPermi('situation:real:add')")
    @Log(title = "大营束管实时", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DySgReal dySgReal)
    {
        return toAjax(dySgRealService.insertDySgReal(dySgReal));
    }

    /**
     * 修改大营束管实时
     */
    @PreAuthorize("@ss.hasPermi('situation:real:edit')")
    @Log(title = "大营束管实时", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DySgReal dySgReal)
    {
        return toAjax(dySgRealService.updateDySgReal(dySgReal));
    }

    /**
     * 删除大营束管实时
     */
    @PreAuthorize("@ss.hasPermi('situation:real:remove')")
    @Log(title = "大营束管实时", businessType = BusinessType.DELETE)
	@DeleteMapping("/{sgcdssIds}")
    public AjaxResult remove(@PathVariable Long[] sgcdssIds)
    {
        return toAjax(dySgRealService.deleteDySgRealBySgcdssIds(sgcdssIds));
    }
}
